const fs = require('fs');
let persons = fs.readFileSync(__dirname + "/persons.json", "utf8");
persons = JSON.parse(persons);
//通过文本框获取的数据内容(表单提交的数据) 
let user = { username: "xiaoming1", password: "1111" }
//文本框输入的值和库房中数据值进行比较，是否满足里面的值
let users = persons.find((item) => {
    //console.log(item);
    return user.username == item.username && user.password == item.password
})
//返回的是成功或者失败状态
if (users) {
    console.log("登陆成功");
} else {
    console.log("登陆失败");
}